package com.vr.xuecheng.auth.controller;

import com.vr.xuecheng.auth.dto.RegisterDTO;
import com.vr.xuecheng.auth.service.IUserService;
import com.vr.xuecheng.base.response.Result;
import com.vr.xuecheng.base.valid.ValidationGroup;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hzh
 * @date 2025/03/31
 */
@Tag(name = "注册接口")
@Slf4j
@RequiredArgsConstructor
@RestController
public class RegisterController {
    private final IUserService userService;
    @Operation(summary = "注册")
    @PostMapping("/register")
    public Result<String> register(@RequestBody @Validated(value = {ValidationGroup.Insert.class}) RegisterDTO registerDTO) {
        userService.register(registerDTO);
        return Result.ok("注册成功");
    }
}
